package com.jason.demo.two

import android.content.Intent
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.jason.demo.two.model.MainItem

/**
 * @description: MainAdapter
 *
 * @author ChenBaoyang
 * @date 5/8/21 14:53
 */
class MainAdapter : BaseQuickAdapter<MainItem, BaseViewHolder>(R.layout.item_main) {

    override fun convert(holder: BaseViewHolder, item: MainItem) {
        holder.setText(R.id.tv_title, item.title)
        holder.itemView.setOnClickListener {
            start(item.clz)
        }
    }

    private fun start(clazz: Class<*>) {
        context.startActivity(Intent(context, clazz))
    }
}